pintobyte rngit
xous-core/emulation/peripherals/LM3509.cs main (17e4bce8) Text, 1.27 KB
//
// Copyright (c) 2010-2021 Antmicro
//
// This file is licensed under the MIT License.
// Full license text is available in 'licenses/MIT.txt'.
//
using Antmicro.Renode.Logging;
using Antmicro.Renode.Utilities;
using Antmicro.Renode.Peripherals.I2C;
namespace Antmicro.Renode.Peripherals.Mocks.Betrusted
{
public class LM3509 : II2CPeripheral
{
public LM3509()
{
Reset();
}
public void Write(byte[] data)
{
this.Log(LogLevel.Debug, "Written {0} bytes of data: {1}", data.Length, Misc.PrettyPrintCollectionHex(data));
buffer = data;
}
public byte[] Read(int count = 1)
{
this.Log(LogLevel.Debug, "Reading {0} bytes", count);
var result = new byte[count];
for(var i = 0; i < result.Length; i++)
{
result[i] = (i < buffer.Length)
? buffer[i]
: (byte)0;
}
return result;
}
public void FinishTransmission()
{
this.Log(LogLevel.Debug, "Finishing transmission");
}
public void Reset()
{
buffer = new byte[0];
}
private byte[] buffer;
}
}
Served by rngit 1.4.0 - Generated in 0.06s